#ifndef _BOARD_CONFIG_H_
#define _BOARD_CONFIG_H_

#include <driver/gpio.h>
#include <driver/uart.h>

#define ML307_TX_PIN GPIO_NUM_44
#define ML307_RX_PIN GPIO_NUM_43


#define AUDIO_INPUT_SAMPLE_RATE  16000
#define AUDIO_OUTPUT_SAMPLE_RATE 16000

#define AUDIO_INPUT_REFERENCE    false

#define AUDIO_I2S_GPIO_MCLK GPIO_NUM_45
#define AUDIO_I2S_GPIO_WS GPIO_NUM_41
#define AUDIO_I2S_GPIO_BCLK GPIO_NUM_39
#define AUDIO_I2S_GPIO_DIN  GPIO_NUM_40
#define AUDIO_I2S_GPIO_DOUT GPIO_NUM_42

#define AUDIO_CODEC_PA_PIN       GPIO_NUM_46
#define AUDIO_CODEC_I2C_SDA_PIN  GPIO_NUM_4
#define AUDIO_CODEC_I2C_SCL_PIN  GPIO_NUM_5
#define AUDIO_CODEC_ES8311_ADDR  ES8311_CODEC_DEFAULT_ADDR

#define BUILTIN_LED_GPIO        GPIO_NUM_NC
#define BOOT_BUTTON_GPIO        GPIO_NUM_0
#define VOLUME_UP_BUTTON_GPIO   GPIO_NUM_6
#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_7


#define DISPLAY_MIRROR_X false
#define DISPLAY_MIRROR_Y false
#define DISPLAY_SWAP_XY false

#define DISPLAY_OFFSET_X  0
#define DISPLAY_OFFSET_Y  0

//#define CONFIG_DISPLAY_USE_ST7789 1
#define CONFIG_DISPLAY_USE_JBD013 1
//#define CONFIG_DISPLAY_USE_M103 1

#ifdef CONFIG_DISPLAY_USE_JBD013
#define DISPLAY_WIDTH   640 
#define DISPLAY_HEIGHT  480
#define DISPLAY_DC_GPIO     GPIO_NUM_NC
#define DISPLAY_CS_GPIO     GPIO_NUM_8
#define DISPLAY_CLK_GPIO    GPIO_NUM_12
#define DISPLAY_MOSI_GPIO   GPIO_NUM_11
#define DISPLAY_RST_GPIO    GPIO_NUM_16

#elif CONFIG_DISPLAY_USE_M103
#define DISPLAY_WIDTH   640 
#define DISPLAY_HEIGHT  480
#define DISPLAY_DC_GPIO     GPIO_NUM_NC
#define DISPLAY_CS_GPIO     GPIO_NUM_8
#define DISPLAY_CLK_GPIO    GPIO_NUM_12
#define DISPLAY_MOSI_GPIO   GPIO_NUM_11
#define DISPLAY_RST_GPIO    GPIO_NUM_16

#elif CONFIG_DISPLAY_USE_ST7789

#define DISPLAY_WIDTH   240
#define DISPLAY_HEIGHT  240
#define DISPLAY_DC_GPIO     GPIO_NUM_15
#define DISPLAY_CS_GPIO     GPIO_NUM_10
#define DISPLAY_CLK_GPIO    GPIO_NUM_12
#define DISPLAY_MOSI_GPIO   GPIO_NUM_11
#define DISPLAY_RST_GPIO    GPIO_NUM_16

#else  // CONFIG_DISPLAY_USE_GC9D01

#define DISPLAY_WIDTH   160
#define DISPLAY_HEIGHT  160
#define DISPLAY_DC_GPIO     GPIO_NUM_15
#define DISPLAY_CS_GPIO     GPIO_NUM_10
#define DISPLAY_CLK_GPIO    GPIO_NUM_12
#define DISPLAY_MOSI_GPIO   GPIO_NUM_11
#define DISPLAY_RST_GPIO    GPIO_NUM_16

#endif

#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_1
#define DISPLAY_BACKLIGHT_OUTPUT_INVERT false

#define UART_ECHO_TXD GPIO_NUM_38
#define UART_ECHO_RXD GPIO_NUM_48
#define UART_ECHO_RTS (-1)
#define UART_ECHO_CTS (-1)

#define MOTOR_SPEED_MAX 100
#define MOTOR_SPEED_80  80
#define MOTOR_SPEED_60  60
#define MOTOR_SPEED_MIN 0

#define ECHO_UART_PORT_NUM      UART_NUM_1
#define ECHO_UART_BAUD_RATE     (115200)
#define BUF_SIZE                (1024)

typedef enum {
    LIGHT_MODE_CHARGING_BREATH = 0,
    LIGHT_MODE_POWER_LOW,
    LIGHT_MODE_ALWAYS_ON,
    LIGHT_MODE_BLINK,
    LIGHT_MODE_WHITE_BREATH_SLOW,
    LIGHT_MODE_WHITE_BREATH_FAST,
    LIGHT_MODE_FLOWING,
    LIGHT_MODE_SHOW,
    LIGHT_MODE_SLEEP,
    LIGHT_MODE_MAX
} light_mode_t;

#endif // _BOARD_CONFIG_H_
